package com.itheima.health.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.health.pojo.Menu;
import com.itheima.health.vo.MenuVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface MenuMapper extends BaseMapper<Menu> {

    //一级菜单查询
    @Select("SELECT id,path,NAME,icon,description,level FROM t_menu WHERE LEVEL=1")
    List<MenuVO> findFirstMenu();

    //二级菜单
    @Select("SELECT id,path,NAME,icon,linkUrl,parentMenuId,description,level FROM t_menu WHERE LEVEL=2 and PARENTMENUID=#{parentId}")
    List<MenuVO> findSecondMenu(@Param("parentId") Integer parentId);
}
